package Testing;

import java.sql.SQLException;

import monsterRun.data.DataConnection;
import monsterRun.server.model.entities.PlayerInfo;

public class TestDataAccessLayer {

	public static void main(String[] args) {
		PlayerInfo pi = null;
		DataConnection dal = new DataConnection();
		
		// Remove all players from the Database
		dal.removeAllPlayerInfo();
		
		// Populate Database with some info
		dal.addPlayerInfo("Gareth", "Ng", "10 Lonsdale Street", 999666333 , "gng", "pass");
		dal.addPlayerInfo("Ian", "Tan", "20 StKilda Street", 333999666 , "itan", "pass");
		dal.addPlayerInfo("Charles", "Han", "30 Bourke Street", 666333999 , "chan", "pass");
		System.out.println();
		
		// Check if the Database has stored the populated info
		dal.getAllPlayerInfo();
		System.out.println();
		
		try {
			// This is when user logs into the system, create new playerInfo
			pi = new PlayerInfo("gng","pass");
		} catch (SQLException e) {
			System.out.println("Error creating PlayerInfo class object");
			e.printStackTrace();
		}
		
		System.out.printf("Player: %s Score: %d",pi.getUsername(), pi.getScore());
		
	}

}